#include<bits/stdc++.h>
#define y1 Y1
#define fi first
#define endl "\n"
#define se second
#define PI acos(-1)
#define int long long
#define pb(x) push_back(x)
#define PII pair<int, int>
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define _for(i, a, b) for(int i = a; i <= b; ++i)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;

const int N = 2e5 + 10;
const int mod = 1e9 + 7;

int a[N];
int sum[N];

int n, k, ret = 0;
string s;

signed main() {
	IOS;
	cin >> n >> k;
	_for(i, 1, n) {
		cin >> a[i];
		int x = a[i];
		sum[i] = sum[i - 1];
		int t = 0;
		
		for(int j = 5; j <= x; j = j * 5 ) {
			t ++ ;
		}
		sum[i] += t;
	}
	
//	for(int i = 1; i <= n; ++ i ) {
//		cout << sum[i] << ' ';
//	}
//	cout << "______" << endl;
	for(int i = 1; i <= n; ++ i ) {
		int l = i - 1;
		int r = n + 1;
		while(l + 1 < r) {
			int mid = l + r >> 1;
			if(sum[mid] - sum[i] < k) l = mid;
			else r = mid;
		}
		cout << "r = " << r << endl;
		ret += (n - r + 1);
		ret %= mod;
	}
	cout << ret << endl;
	return 0;
}
// 5  2
//  5 2 3 50 4

